/**
 * 打乱数组函数
 * @param source
 * @returns
 */
export function shuffle<T = any> (list: T[]): T[] {
  const source = list.slice()
  for (let i = 0; i < source.length; i++) {
    swap(source, i, getRandomInt(source.length - 1))
  }
  return source
}

function getRandomInt (max: number): number {
  return Math.floor(Math.random() * (max + 1))
}

function swap<T> (arr: T[], i: number, j: number): void {
  const temp = arr[i]
  arr[i] = arr[j]
  arr[j] = temp
}

// export function formatTime(interval) {
//   interval = interval | 0
//   const minute = ((interval / 60 | 0) + '').padStart(2, '0')
//   const second = (interval % 60 + '').padStart(2, '0')
//   return `${minute}:${second}`
// }
